home *** CD-ROM | disk | FTP | other *** search
- // base2.cpp: Shows the bases of integers
- // (Uses manipulators)
- #include <iostreams.h>
-
- main()
- {
- int x, y, z;
-
- cout << "Enter three ints: ";
- cin >> x >> y >> z;
- cout << x << ',' << y << ',' << z << endl;
-
- // Print in different bases
- cout << dec << x << ',' << oct << y << ','
- << hex << z << endl;
-
- // Show the base prefix
- cout.setf(ios::showbase);
- cout << dec << x << ',' << oct << y << ','
- << hex << z << endl;
- return 0;
- }
-
-